package com.jb.workflow.app.client;

public class StepDescriptor {
	
	private int finishedStepCount;
	
	public int getFinishedStepCount() {
		return finishedStepCount;
	}
	
	private String[] stepDesp;
	
	public StepDescriptor(boolean needDriver) {
		if (needDriver) {
			finishedStepCount = 5;
			stepDesp = WfUtil.stepDespcriptionWithDriver;
		} else {
			finishedStepCount = 3;
			stepDesp = WfUtil.stepDespcriptionWithNotDriver;
		}
	}
	
	/**
	 * 获得当前处于的阶段，默认得到输入的开始.
	 * <br>1) 需要司机发货：
	 * <br>1条comment，当前步骤是<库房接单提货>
	 * <br>2条comment，当前步骤是<客服安排司机发货>
	 * <br>2) 不需要司机发货：
	 * <br>1条comment，当前步骤是<库房接单提货>
	 * <br>2条comment，当前步骤是<客服回传发货单>
	 * <br>3条comment，当前步骤是<已结束>
	 * @param commentCount
	 * @return
	 */
	public String getCurrStepDesp(int commentCount) {
		String desp = "Unknown";
		if (commentCount >= 0 && commentCount < stepDesp.length) {
			desp = stepDesp[commentCount];
		}
		return desp;
	}
	
	/**
	 * 
	 * @param step
	 * @return
	 */
	public String getStepEndDesp(int step) {
		return getCurrStepDesp(step);
	}
	
	public boolean isFinished(int stepCount) {
		return finishedStepCount == stepCount;
	}
	
}
